
/*Procurement Analysis
STATA 14
January 12, 2017
Replicates  Table 1, Table 3, CI Bar for Online Appendix*/

cd  "C:\Users\ejm5\Dropbox\Rents_Asunder\CountryofOrigin\20160315_InternationaOrganization\Replication"
use  oecd_7years_working.dta, clear
log using procurement.smcl, replace

/*Pause Turned On to Stop at Main Replication Figures and Tables*/
pause on


/*Limit to early entrants*/
drop if a1<2005


/*Firms question with different number of values, because question asked differently*/
drop if year==2012


#delimit;
cibar e9, 
over1(treatment2) over2(oecd) level(90) 
graphopts(ytitle("Average Activities during Procurement", size(medium) margin(medium)) scheme(s1mono) note("Range bars=90% CI")) barlabel(on);

graph save all_countries_proc.gph, replace;
graph export all_countries_proc.pdf, as(pdf) replace;



/*Table 1: Panel 2*/
#delimit;
mean e9, over(treatment2);
pause;



/*********************************************************************************************************************************/
/*Table 3: Registration*/
#delimit cr

/*Model 1*/
set more off
xi: reg e9 if treatment2==0, cluster(pci_id)
predict ns_items
generate bribe=e9-ns_items
nl (bribe = {b0}) if treatment2==1, cluster(pci_id) vce(bootstrap, reps(1000))   
estimates store T2_Model1   
outreg2 using 20161119_DinD_proc,  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, No, Sector FE, No, Firm Countrols, No, Country Controls, No,  Asia Big 4, No) replace
drop ns_items bribe

/*Model 2*/
set more off
xi: reg e9 oecd  if treatment2==0, cluster(pci_id)
predict ns_items
generate bribe=e9-ns_items
nl (bribe = {b0}+{b1}*oecd) if treatment2==1, cluster(pci_id) vce(bootstrap, reps(1000))    variables (oecd)
estimates store T2_Model2
mfx
outreg2 using 20161119_DinD_proc, mfx bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, No, Sector FE, No, Firm Countrols, No, Country Controls, No,  Asia Big 4, No)
drop ns_items bribe

/*Model 3*/
#delimit;
set more off;
xi: reg e9 y2  y4 y5 y6 y7 oecd  if treatment2==0, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b7}*oecd) if treatment2==1, 
cluster(pci_id) vce(bootstrap, reps(1000))  variables (y2  y4 y5 y6 y7 oecd);
estimates store T2_Model3;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, No, Firm Countrols, No, Country Controls, No,  Asia Big 4, No);
drop ns_items bribe;

/*Model 4*/
#delimit;
set more off;
xi: reg e9 y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5   if treatment2==0, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b6}*oecd+{b7}*a6_1+{b8}*a6_2+{b9}*a6_3+{b10}*a6_4+{b11}*a6_5) if treatment2==1, 
vce(bootstrap, reps(1000))  cluster(pci_id)   variables (y2 y3 y4 y5 y6 y7 oecd  a6_1 a6_2 a6_3 a6_4 a6_5);
estimates store T2_Model4;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, Yes, Firm Countrols, No, Country Controls, No,  Asia Big 4, No);
drop ns_items bribe;


/*Model 5*/
#delimit;
set more off;
xi: reg e9 y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est  d2  if treatment2==0 & a1>=2005, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b6}*oecd+{b7}*a6_1+{b8}*a6_2+{b9}*a6_3+{b10}*a6_4+{b11}*a6_5+{b12}*hundred+
   {b13}*labor_est+{b14}*d2) if treatment2==1, 
vce(bootstrap, reps(1000))  cluster(pci_id)   variables (y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est  d2);
estimates store T2_Model5;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, Yes, Firm Countrols, Yes, Country Controls, No,  Asia Big 4, No);
drop ns_items bribe;


/*Model 6*/
#delimit;
set more off;
xi: reg e9 y2  y4 y5 y6 y7 oecd  a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est  d2 ln_gdp_pc   ln_pop p_polity2  if treatment2==0, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b6}*oecd+{b7}*a6_1+{b8}*a6_2+{b10}*a6_3+{b11}*a6_4+{b12}*a6_5
+{b13}*hundred+{b14}*labor_est+{b15}*d2+{b16}*ln_gdp_pc+{b17}*ln_pop+{b18}*p_polity2) if treatment2==1, 
vce(bootstrap, reps(1000))  cluster(pci_id)   variables (y2  y4 y5 y6 y7  oecd  a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est  d2 ln_gdp_pc   ln_pop p_polity2);
estimates store T2_Model6;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, Yes, Firm Countrols, Yes, Country Controls, Yes,  Asia Big 4, No);
drop ns_items bribe;


/*Model 7*/
#delimit;
set more off;
xi: areg e9 y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5  hundred  labor_est  d2 ln_gdp_pc   ln_pop p_polity2    if treatment2==0 ,  absorb(a1);
predict ns_items;
generate bribe=e9-ns_items;
xi: areg bribe y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5  hundred  labor_est  d2 ln_gdp_pc   ln_pop p_polity2  if treatment2==1,   
absorb(a1) vce(bootstrap, reps(1000));
estimates store T2_Model7;
outreg2 using 20161119_DinD_proc, bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, Yes, Firm Countrols, Yes, Country Controls, No, Country FE, Yes,  Asia Big 4, No);
drop ns_items bribe;


#delimit;
preserve; 
keep if country_id==25|country_id==50|country_id==47|country_id==56;

/*Model 7*/
set more off;
xi: reg e9 if treatment2==0, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}) if treatment2==1, cluster(pci_id)  vce(bootstrap, reps(1000)) ;
estimates store T2_Model8;   
outreg2 using 20161119_DinD_proc,   bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, No, Sector FE, No, Firm Countrols, No, Country Controls, No,  Asia Big 4, Yes);
drop ns_items bribe;
restore;

#delimit;
preserve; 
keep if country_id==25|country_id==50|country_id==47|country_id==56;

/*Model 8*/
#delimit;
set more off;
xi: reg e9 y2 y4 y5 y6 y7 oecd  if treatment2==0, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b6}*oecd) if treatment2==1, 
cluster(pci_id) vce(bootstrap, reps(1000))   variables (y2 y4 y5 y6 y7 oecd);
estimates store T2_Model9;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, No, Firm Countrols, No, Country Controls, No,  Asia Big 4, Yes);
drop ns_items bribe;
restore;

#delimit;
preserve; 
keep if country_id==25|country_id==50|country_id==47|country_id==56;

/*Model 9*/
#delimit;
set more off;
xi: reg e9 y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est equity_est d2  if treatment2==0 & a1>=2005, cluster(pci_id);
predict ns_items;
generate bribe=e9-ns_items;
nl (bribe = {b0}+{b1}*y2+{b2}*y4+{b3}*y5+{b4}*y6+{b5}*y7+{b6}*oecd+{b7}*a6_1+{b98}*a6_2+{b9}*a6_3+{b10}*a6_4+{b11}*a6_5+{b12}*hundred+
   {b13}*labor_est+{b14}*d2) if treatment2==1, 
vce(bootstrap, reps(1000))  cluster(pci_id)   variables (y2  y4 y5 y6 y7 oecd a6_1 a6_2 a6_3 a6_4 a6_5 hundred  labor_est  d2);
estimates store T2_Model10;
mfx;
outreg2 using 20161119_DinD_proc, mfx  bdec(3) tdec(3) e(N N_clust rmse ll ) addtext(Survey Year FE, Yes, Sector FE, Yes, Firm Countrols, Yes, Country Controls, No,  Asia Big 4, Yes) excel;
drop ns_items bribe;




/*LR TESTS*/
lrtest T2_Model1 T2_Model2, stats force;
lrtest T2_Model1 T2_Model3, stats force;
lrtest T2_Model1 T2_Model4, stats force;
lrtest T2_Model1 T2_Model5, stats force;
lrtest T2_Model1 T2_Model6, stats force;
lrtest T2_Model1 T2_Model7, stats force;
lrtest T2_Model8 T2_Model9, stats force;
lrtest T2_Model9 T2_Model10, stats force;
log close;














